package com.api.shopapi.mapper;

import com.api.shopapi.entity.RechargeGroup;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface RechargeGroupMapper {

    @Insert("insert into recharge_group " +
            "(" +
            "RechargeGroupCode, " +
            "Name, " +
            "CreateTime, " +
            "StaffCode, " +
            "GovernmentCode, " +
            "TotalMoney, " +
            "TotalElderly, " +
            "RechargeType) " +
            "VALUES " +
            "(" +
            "#{rechargeGroup.RechargeGroupCode} ," +
            "#{rechargeGroup.Name} ," +
            "#{rechargeGroup.CreateTime} ," +
            "#{rechargeGroup.StaffCode} ," +
            "#{rechargeGroup.GovernmentCode}," +
            "#{rechargeGroup.TotalMoney} ," +
            "#{rechargeGroup.TotalElderly} ," +
            "#{rechargeGroup.RechargeType}  )")
    int insert(@Param("rechargeGroup") RechargeGroup rechargeGroup);



    @Select("select * from recharge_group where GovernmentCode=#{governmentCode} order by CreateTime desc ")
    List<RechargeGroup> getListForPage(@Param("governmentCode") String governmentCode);

}
